Skip to content

Conversation

@odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jun 24, 2025

What do these changes do?

This PR makes the Conversations listen the WebSocket events, reducing the GET messages calls and giving a better UX.

  • create
  • update
  • delete
  • Remove the WebSocket listeners

ConversationMessages

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jun 24, 2025
@odeimaiz odeimaiz added t:enhancement Improvement or request on an existing feature a:frontend issue affecting the front-end (area group) labels Jun 24, 2025
@odeimaiz odeimaiz added this to the Engage milestone Jun 24, 2025
@odeimaiz odeimaiz changed the title ✨ [Frontend] Conversations: Listen to websocket ✨ [Frontend] Conversation Messages: Listen to WebSocket Jun 25, 2025
@odeimaiz odeimaiz marked this pull request as ready for review June 25, 2025 08:07
@odeimaiz odeimaiz requested a review from Copilot June 25, 2025 08:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the conversation messages UX by integrating WebSocket events for creating, updating, and deleting messages while refactoring event names and message handling methods.

  • Introduces WebSocket event listeners to handle real-time message updates.
  • Refactors message-related functions and events (e.g., from "messageEdited" to "messageUpdated") in multiple components.
  • Adjusts conversation loading and message insertion logic to support real-time updates.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/static-webserver/client/source/class/osparc/study/Conversations.js Added WebSocket listener setup and updated message deletion API call.
services/static-webserver/client/source/class/osparc/conversation/NotificationUI.js Refactored to use property-based message handling.
services/static-webserver/client/source/class/osparc/conversation/MessageUI.js Updated event names and switched from instance variables to properties.
services/static-webserver/client/source/class/osparc/conversation/Conversation.js Modified message fetching to use reloading method and adjusted message insertion order.
services/static-webserver/client/source/class/osparc/conversation/AddMessage.js Revised event notifications to align with updated messaging event names.
Comments suppressed due to low confidence (2)

services/static-webserver/client/source/class/osparc/study/Conversations.js:273

  • Verify that socket.removeSlot(eventName) properly unregisters the specific event handlers added with socket.on. It might be more robust to pass both the event name and the handler reference to ensure correct clean-up.
        socket.removeSlot(eventName);

Copy link
Contributor

@giancarloromeo giancarloromeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 🚀

@pcrespov
Copy link
Member

Very nice!
Observations on the video:

  • the edit does not change the timestamp. Should also add "Edited"?
  • if deleted. It should leave a trace "Deleted on XXX"

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@odeimaiz
Copy link
Member Author

odeimaiz commented Jun 25, 2025

  • the edit does not change the timestamp. Should also add "Edited"?

We could... Done

  • if deleted. It should leave a trace "Deleted on XXX"

@matusdrobuliak66 suggested it in a previous PR, the problem is that we don't keep track of deleted messages

@odeimaiz odeimaiz added the 🤖-automerge marks PR as ready to be merged for Mergify label Jun 25, 2025
@odeimaiz
Copy link
Member Author

@mergify queue

@sonarqubecloud
Copy link

@mergify
Copy link
Contributor

mergify bot commented Jun 25, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at f98ad3a

@mergify mergify bot merged commit f98ad3a into ITISFoundation:master Jun 25, 2025
60 checks passed
@pcrespov
Copy link
Member

pcrespov commented Jun 25, 2025

  • if deleted. It should leave a trace "Deleted on XXX"

@matusdrobuliak66 suggested it in a previous PR, the problem is that we don't keep track of deleted messages

@odeimaiz @matusdrobuliak66 here is an idea: instead of deleting a message, you edit it with a reserved word like #DELETED_MESSAGE. (and make sure that the front-end cannot edit it)

@odeimaiz odeimaiz deleted the feature/messages-via-ws branch June 25, 2025 10:23
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) t:enhancement Improvement or request on an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants